< previous page page_573 next page >

Page 573
9f31265bb40b592b1929e18a47ab28e5.gif
Private mlngAvailVirtual As Long
Private mlngCPUType As Long
Private mlngNumCPU As Long
This code retrieves three types of information for filling in the properties of the System Information classthe operating system information, the memory and system information, and the Windows directory information. In each of the Property Get procedures of this class, youll find a call to a private method thats responsible for filling in all the properties.
Retrieving the Operating System Version
The OperatingSystem property makes a call to a private method called OSystemGet():
9f31265bb40b592b1929e18a47ab28e5.gif
Property Get OperatingSystem() As String

   Call OSystemGet
   OperatingSystem = mstrOS

End Property
The OSystemGet() method fills in the module level variable mstrOS.
The OSystemGet() Method
To retrieve the name of the operating system your application is currently running on, you use the GetVersionEx() Windows API call. This function call fills in the OSVERSIONINFO user-defined type:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub OSystemGet()
   Dim typOS As OSVERSIONINFO
   Dim lngWord As Long

   typOS.dwOSVersionInfoSize = 148
   lngWord = GetVersionEx(typOS) 

   If typOS.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS Then
      mstrOS = "Windows 95/98"
   ElseIf typOS.dwPlatformId = VER_PLATFORM_WIN32_NT Then
      mstrOS = "Windows NT"
   End If

 
< previous page page_573 next page >

If you like this book, buy it!